home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / SAMPLES.JAR / com / jproxy / samples / rmi / test / TestServer.java < prev   
Encoding:
Java Source  |  2003-04-29  |  908 b   |  46 lines

  1. package com.jproxy.samples.rmi.test;
  2.  
  3. import javax.naming.*;
  4. import java.rmi.*;
  5. import java.util.*;
  6.  
  7. import com.jproxy.samples.interfaces.ITest;
  8.  
  9. public class TestServer
  10. {
  11.     public static void main(String[] args)
  12.     {
  13. //        System.setSecurityManager(new RMISecurityManager());
  14.  
  15.         try {
  16.             // Create object to be bound
  17.             ITest test = new TestImpl();
  18.  
  19.             // Create the initial context
  20.             InitialContext context = new InitialContext();
  21.  
  22.             context.rebind("test", test);
  23.  
  24.             test = (ITest) context.lookup("test");
  25.  
  26.             System.out.println(
  27.                 "\r\n**********************************"+
  28.                 "\r\nRMI Test "+
  29.                 "\r\nServer Time: "+(new Date(test.getServerTime()))+
  30.                 "\r\nServer started. "+
  31.                 "\r\n**********************************\r\n");
  32.  
  33.             // Close the context
  34.             context.close();
  35.         }
  36.         catch (NamingException e)
  37.         {
  38.             e.printStackTrace();
  39.         }
  40.         catch (RemoteException e)
  41.         {
  42.             e.printStackTrace();
  43.         }
  44.     }
  45. }
  46.